<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Diary</title>
    <style>
        /* 全局样式 */
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 20px;
            background-color: #f5f5f5;
        }
        h1, h2 {
            color: #333;
        }
        form {
            background-color: #fff;
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            margin-bottom: 20px;
        }
        label {
            display: block;
            margin-bottom: 5px;
        }
        input[type="text"], textarea {
            width: 100%;
            padding: 10px;
            margin-bottom: 15px;
            border: 1px solid #ccc;
            border-radius: 5px;
        }
        input[type="submit"] {
            padding: 10px 20px;
            background-color: #4CAF50;
            color: #fff;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }
        input[type="submit"]:hover {
            background-color: #45a049;
        }
        ul {
            list-style-type: none;
            padding: 0;
        }
        li {
            background-color: #fff;
            padding: 10px;
            margin-bottom: 10px;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        li strong {
            display: block;
            margin-bottom: 5px;
        }
    </style>
</head>
<body>
    <h1>My Diary</h1>
    <form action="/submit" method="post">
        <label for="weather">Weather:</label>
        <input type="text" id="weather" name="weather" required>
        <label for="mood">Mood:</label>
        <input type="text" id="mood" name="mood" required>
        <label for="events">Events:</label>
        <textarea id="events" name="events" required></textarea>
        <input type="submit" value="Submit">
    </form>
    <h2>History</h2>
    <ul>
        {% for diary in diaries %}
            <li>
                <strong>Date:</strong> {{ diary.date }}
                <strong>Weather:</strong> {{ diary.weather }}
                <strong>Mood:</strong> {{ diary.mood }}
                <strong>Events:</strong> {{ diary.events }}
            </li>
        {% endfor %}
    </ul>
</body>
</html>